<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        var num = Number(prompt("请输入一个整数"));
        var isSu = true;
        //只能被1和自身整除
        for(var i = 2;i<num;i ++){
            if(num % i ==0){
                isSu = false;
                break;
            }
        
        }
        if (isSu){
            console.log(num+"是素数");
        }else{
            console.log(num+"不是素数");
        }

    </script>
</head>
<body>
    
</body>
</html>